<template>
  <div class="book-search">
    <nav-bar :isFixed="false" :title="'证书查询'"></nav-bar>
    <van-form @submit="onSubmit">
      <van-field
        v-model="form.licensee"
        name="姓名"
        label="姓名"
        placeholder="请输入姓名"
        :rules="[{ required: true, message: '请填写姓名' }]"
      />
      <van-field
        v-model="form.number"
        name="证书标编号"
        label="证书标编号"
        placeholder="请输入证书标编号"
        :rules="[{ required: true, message: '请填写证书标编号' }]"
      />
      <div style="margin: 16px;">
        <van-button color="#0050A5" round block type="info" native-type="submit"
          >立即查询</van-button
        >
      </div>
    </van-form>
  </div>
</template>

<script>
import navBar from "@/components/NavBar";
export default {
  name: "ActivityList",
  components: {
    navBar
  },
  data() {
    return {
      courseId: "",
      form: {}
    };
  },
  methods: {
    async onSubmit() {
      let res = await this.$request({
        url: "/certificate/findCertificate",
        method: "post",
        data: this.form
      });
      console.log(res);
      this.$router.push({
        name: "bookSearchRes",
        query: {
          searchRes: res.data ? JSON.stringify(res.data) : res.data
        }
      });
    }
  },
  mounted() {
    this.courseId = this.$route.query.courseId;
  }
};
</script>

<style lang="scss">
@import "../assets/css/base";
</style>
